﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using PureMVC.Patterns;
using PureMVC.Interfaces;
using GameEngine.Clients.Silverlight.View;
using MySettlers.Screens;
using GameEngine.Model.Data;
using System.IO;
using GameEngine.Clients.Silverlight;
using MySettlers.View.Components.editor;

namespace MySettlers.Commands
{
    public class Page_EditorLoadGame_In_Command : SimpleCommand
    {
        override public void Execute(INotification notification)
        {
            IGameVO<int> gameVO = notification.Body as IGameVO<int>;
            var gameDataProxy = SilverlightApplicationFacadeHelper.CreateGame(gameVO);
            var levelDataProxy = SilverlightApplicationFacadeHelper.CreateLevel(gameDataProxy.Levels[gameVO.LevelOrder[gameVO.CurrentLevel]]);
            var worldDataProxy = SilverlightModelFacade.Helper.GetWorldDataProxy(gameDataProxy.Levels[gameVO.LevelOrder[gameVO.CurrentLevel]].Worlds[0].Id);

            var screen = new EditorPreSettingsUC();
            var mediator = MyViewFacade.Instance.CreateMenuMediator<string, EditorPreSettingsUC>(
                MyFacade.EditorPreSettingsPageMediatorName,
                screen,
                MyFacade.PAGE_EDITORNEWGAME_OUT_COMMAND);
            MyFacade.Instance.RegisterMediator(mediator);

            screen.GameName = gameDataProxy.Name;
            screen.MapWidth = worldDataProxy.Map.Size.X.ToString();
            screen.MapHeight = worldDataProxy.Map.Size.Y.ToString();
            MyFacadeHelper.DesktopNavigate(mediator.ViewComponent);
        }
    }

    public class Page_EditorLoadGame_Out_Command : SimpleCommand
    {
        override public void Execute(INotification notification)
        {
            
        }
    }
}
